package cool.mtc.minghe.service.manager.sys.role.impl;

import cool.mtc.minghe.data.model.base.Dict;
import cool.mtc.minghe.service.manager.BaseManagerImpl;
import cool.mtc.minghe.service.manager.sys.role.RoleManager;
import cool.mtc.minghe.service.mapper.sys.role.RoleMapper;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 明河
 */
@Service
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class RoleManagerImpl extends BaseManagerImpl implements RoleManager {
    private final RoleMapper roleMapper;

    @Override
    @Cacheable(value = "dict:role", key = "'all'", unless = "null == #result")
    public List<Dict> listDict() {
        return roleMapper.listDict();
    }

    @Override
    @CacheEvict(value = "dict:role", allEntries = true)
    public void clearDictCache() {
    }
}
